<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./js/lodash.js"></script>
    <script>
      // _.camelCase([string='']): 转换字符串string为驼峰写法。
      console.log(
        _.camelCase("Foo Bar"),
        _.camelCase("--foo-bar--"),
        _.camelCase("__FOO_BAR__")
      );

      // _.capitalize([string='']): 转换字符串string首字母为大写，剩下为小写。
      console.log(_.capitalize("FRED"));

      // _.endsWith([string=''], [target], [position=string.length]): 检查字符串string是否以给定的target字符串结尾
      console.log(
        _.endsWith("abc", "c"),
        _.endsWith("abc", "b"),
        _.endsWith("abc", "b", 2)
      );

      // _.escape([string='']): 转义string中的 "&", "<", ">", '"', "'", 和 "`" 字符为HTML实体字符。
      console.log(_.escape("fred, barney, & pebbles"));

      // _.unescape([string='']):
      console.log(_.unescape("fred, barney, & pebbles"));
    </script>
  </body>
</html>
